package com.hh.tc.ui.main

import android.os.Bundle
import com.hh.base.ui.BaseActivity
import com.hh.tc.R
import com.hh.tc.databinding.ActivityMainBinding

class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
    override fun getLayoutId(): Int = R.layout.activity_main

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initObserve()
    }

    private fun initObserve() {
        viewModel.drawerState.observe(this) {
            it.getContentIfNotHandled()?.let { status ->
                when (status) {
                    is MainViewModel.DrawerState.Open -> dataBinding.mainDrawer.open()
                    is MainViewModel.DrawerState.Closed -> dataBinding.mainDrawer.close()
                }
            }
        }
    }
}